package priv.yiyuan.example.design.visitor;

import priv.yiyuan.example.design.visitor.strategy.image.ImageExportStrategy;
import priv.yiyuan.example.design.visitor.strategy.text.TextExportStrategy;

/**
 * 数据导出访问者
 *
 * @author YiYuan
 * @data 2025/8/4
 * @apoNote
 */
public class DataExportVisitorImpl implements DataVisitor {

    private TextExportStrategy textExportStrategy;

    private ImageExportStrategy imageExportStrategy;

    public DataExportVisitorImpl(TextExportStrategy textExportStrategy, ImageExportStrategy imageExportStrategy) {
        this.textExportStrategy = textExportStrategy;
        this.imageExportStrategy = imageExportStrategy;
    }

    @Override
    public void visit(TextData element) {
        textExportStrategy.export(element);
    }

    @Override
    public void visit(ImageData element) {
        imageExportStrategy.export(element);
    }
}
